import request from '../utils/request';

const baseUrl = "/lesson";


const Method = {POST:'post', GET:'get'};
const fetch = (url, method='get', params={}) => {
    return request(`${baseUrl}${url}`, {
        method,
        data: {
            ...params,
        },
    });
}


/**
 * 登录
 * @param params
 */
const login = (params) => {
    return fetch('/wx/login', Method.POST, params);
}


/**
 * 获得验证码
 * @param params
 */
const getVerifyCode = (params) => {
    return fetch('/wx/sign', Method.POST, params);
}


/**
 * 获得用户信息
 * @param params
 */
const getProfile = (params) => {
    return fetch('/wx/getGuarder', Method.GET, params);
}

/**
 * 获得课程信息
 * @param params
 */
const getLessons = (params) => {
    return fetch('/wx/lessonList', Method.POST, params)
}

/**
 * 获得课程反馈
 * @param params
 */
const getFeedbacks = (params) => {
    return fetch('/wx/feedBackList', Method.POST, params)
}

/**
 * 获得学生课程反馈详情
 * @param params
 */
const getLessonFeedBackDetail = (params) => {
    return fetch('/wx/getLessonFeedBackDetail', Method.POST, params)
}

/**
 * 登录
 * @param params
 */
const author = (params) => {
    return fetch('', Method.GET, params);
}

export { login, getVerifyCode, author, getProfile, getLessons, getFeedbacks, getLessonFeedBackDetail}

